#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
	int n;
	cin >> n;
	long long money;
	cin >> money;
	vector <long long> a;
	for(int i=1;i<=n;i++)
	{
		cin >> a[i];
	}
	sort(a.begin(),a.end());
	int ans=0;
	int i=1;
	int j=n;
	while(i<j)
	{
		
		long long all=(a[i]+a[j])*2;
		if(all==money)
		{
			ans=ans+1;
			i++;
			j--;
		}
		else if(all<money)
		{
			i++;
		}
		else if(all>money)
		{
			j--;
		}
	}
	cout << ans << endl;
	return 0;
}
